package com.fly.lambda.train;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.Test;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class LambdaTest002
{
    String columnSql = "id, name, age";
    
    @Test
    public void test()
    {
        if (StringUtils.isNoneBlank(columnSql))
        {
            List<String> list = Arrays.stream(columnSql.split(",")).filter(StringUtils::isNotBlank).map(c -> String.format("coalesce(%s, '') as %s", c.trim(), c)).collect(Collectors.toList());
            String result = StringUtils.join(list, ", ");
            log.info(result);
        }
    }
}
